<template>
	<om-formsub-outer :index="index" :checkedit="checkedit">
		<om-autoform ref="autoform" :edit="edit" :checkedit="checkedit" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '../../../static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData({
				exists:'',
			})
		},
		methods: {
			onSelectInterviewElement(item){
				this.$refs.autoform.formdata.score = item.score
			},
			clearInterviewElement(){
				this.$refs.autoform.clear("title15","interviewElementId")
				this.$refs.autoform.clear("title15","score")
			},
			initLoad(){
				let _that = this
				//面试要素
				_that.om.request('trecruitAgencyInterviewEvaluate/getElementByH5', {
					listStr: this.exists					
				}).then(res => {
					_that.$refs.autoform.changeEditor("title15","interviewElementId","data",configSelectData(res,"id","dicname"))
					_that.$refs.autoform.initSelectIndex("title15", "interviewElementId")
				});
			}
		},
		onLoad(e){
			let _that = this
			subOnLoad(_that, e, function() {
				if(e.configDataCacheKey){
					_that.exists = _that.datas.filter((e,i)=>{
						return (i != _that.index)
					}).map(e=>e.interviewElementId).join(",")
					uni.getStorage({
						key: e.configDataCacheKey,
						success: function(res) {
							//if(res.data && res.data instanceof Array){
							if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
								_that.autoformdata = res.data
								Object.assign(_that.initValue, _that.formdata)
								_that.autoformdata[0].order = _that.order
								_that.initLoad()
							}
						}
					});
				}
			})
		}
	}
</script>

<style>

</style>
